<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,
        body,
        div {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            height: 100%;
        }

        .main {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .top {
            height: 100px;
            background: red;
        }

        .middle {
            flex: 1;
            background: yellow;
        }

        .bottom {
            height: 100px;
            background: blue;
        }
    </style>
</head>

<body>

    <body>
        <div class="main">
            <div class="top">top</div>
            <div class="middle"></div>
            <div class="bottom">bottom</div>
        </div>
    </body>
</body>

</html>